package com.dhl.cloud.course.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dhl.cloud.common.util.DateUtils;
import com.dhl.cloud.course.dao.LessionTransaudioMapper;
import com.dhl.cloud.course.entity.LessionTransaudio;

@Service
public class LessionTransaudioService {
	@Autowired
	private LessionTransaudioMapper lessionTransaudioMapper;
 
	public List<LessionTransaudio> selectByLessionid(Integer lessionid) {
		return lessionTransaudioMapper.selectByLessionid(lessionid);
	}
	
	public int deleteByPrimaryKey(Integer id) {
		return lessionTransaudioMapper.deleteByPrimaryKey(id);
	}
	
	public int insert(LessionTransaudio c) {
		if (c.getId() != null)
		{
			LessionTransaudio cc = lessionTransaudioMapper.selectByPrimaryKey(c.getId());
			cc.setFilename(c.getFilename());
			cc.setFilesize(c.getFilesize());
			cc.setFilepath(c.getFilepath());
			cc.setLessionnum(c.getLessionnum());
			cc.setModifytime(DateUtils.getDateTime());
			return lessionTransaudioMapper.updateByPrimaryKey(cc);
		}
		else
		{
			c.setCreatetime(DateUtils.getDateTime());
			return lessionTransaudioMapper.insert(c);
		}
		
		//
		
	}
}
